public class Animal {
    String name="aaaa";

    public void eat(){
        System.out.println("吃东西。。。。。");

    }
}


class Dog extends Animal{

    String name;

    public Dog(String name) {
        this.name = name;
    }

    public void eat(){
        System.out.println("吃狗粮。。。");


    }




}

class Cat extends Animal{

    String name;

    public Cat(String name) {
        this.name = name;
    }

    public void eat(){
        System.out.println("吃猫粮。。。");


    }




}

class Test{
public static void eat(Animal animal){
    animal.eat();

}
    public static void main(String[] args) {
        Dog dog=new Dog("旺财");
       eat(dog);
       Cat cat=new Cat("小黑");
       eat(cat);

    }



}
